﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<CommonLibrary.DataModel.Basic.UserEntity>" %>
<!--partial view 方法-->

<script type="text/javascript">
    function saveUserInfo() {
        var userid = $("#userinfo #userid").val();
        //alert(userid);
        var username = $("#username").val();
        var loginid = $("#loginid").val();
        var loginpsw = $("#loginpsw").val();
        var userstatus = "1";
        var usersspqx = "-1" //$("#usersspqx").val();
        var user_znxdx = $("#user_znxdx").val();
        var user_rldx = $("#user_rldx").val();
        var user_auth = $("#user_auth").val();
        //alert(userstatus);
        $.ajax({
            type: "POST",
            url: "/Basic/DoUserUpdate",
            data: { "userid": userid, "username": username, "loginid": loginid, "loginpsw": loginpsw, "userstatus": userstatus, "usersspqx": usersspqx, "user_znxdx": user_znxdx, "user_rldx": user_rldx, "user_auth": user_auth },
            success: function(restag) {
                if (restag.res != true) {
                    alert(restag.msg);
                }
                else {
                    alert("操作成功");
                    $.fn.deltab('6-2-1');
                    $('#menu_alluserlist').trigger('click');
                }
            }
        });
    }
    function delUserInfo() {
        var userid = $("#userinfo #userid").val();
        //alert(userid);
        var username = $("#username").val();
        var loginid = $("#loginid").val();
        var loginpsw = $("#loginpsw").val();
        var userstatus = "0";
        var usersspqx = $("#usersspqx").val();
        var user_znxdx = $("#user_znxdx").val();
        var user_rldx = $("#user_rldx").val();
        var user_auth = $("#user_auth").val();
        //alert(userstatus);
        $.ajax({
            type: "POST",
            url: "/Basic/DoUserUpdate",
            data: { "userid": userid, "username": username, "loginid": loginid, "loginpsw": loginpsw, "userstatus": userstatus, "usersspqx": usersspqx, "user_znxdx": user_znxdx, "user_rldx": user_rldx, "user_auth": user_auth },
            success: function(restag) {
                if (restag.res != true) {
                    alert(restag.msg);
                }
                else {
                    alert("操作成功");
                    $.fn.deltab('6-2-1');
                    $('#menu_alluserlist').trigger('click');
                }
            }
        });
    }

</script>

<div id="userinfo">
    <fieldset>
        <div>
            <%= Html.Hidden("userid", Model.user_id.ToString())%></div>
        <div style="width: 100%;">
            <input type="button" onclick="saveUserInfo()" value="保存" style="margin-top: 5px;" />
            <input type="button" onclick="delUserInfo()" value="删除" style="margin-top: 5px;" /></div>
        <br />
        <div style="margin-left: 10px; width: 320px;">
            <p style="margin: 10px 0;">
                <span style="padding-left: 25px;">姓名:</span>
                <%= Html.TextBox("username", Model.user_name, new { @style = "width:200px; margin-left:8px; border:solid 1px #6C92AD;" })%></p>
            <p style="margin: 10px 0;">
                登录账号:
                <%= Html.TextBox("loginid", Model.user_loginid, new {  @style = "width:200px; margin-left:8px; border:solid 1px #6C92AD;" })%></p>
            <p style="margin: 10px 0;">
                <span style="padding-left: 25px;">密码:</span>
                <%= Html.Password("loginpsw", Model.user_psw, new { @style = "width:200px; margin-left:8px; border:solid 1px #6C92AD;" })%></p>
            <p style="margin: 10px 0;">
                <span style="padding-left: 25px;">创建日期:</span>
                <%= Html.Encode(String.Format("{0:g}", Model.user_ctime)) %></p>
            <p style="margin: 10px 0;">
                <span style="padding-left: 25px;">部门:</span>
                <%= ViewData["dept_name"]%></p>
            <p style="margin: 10px 0;">
                <span style="padding-left: 25px;">职位:</span>
                <%=  ViewData["duty_name"]%></p>
            <%--   <p style="margin: 10px 0;">
                <span style="padding-left: 25px;">状态:</span>
                <%=Html.DropDownList("userstatus", ViewData["list_status"] as List<SelectListItem>, new { @style = "width:202px; margin-left:8px; padding:0px;border-radius:0px 0px 0px 0px;border:solid 1px #6C92AD;" })%>
            </p>--%>
            <p style="margin: 10px 0;">
                短信-站内信:
                <%=Html.DropDownList("user_znxdx", ViewData["list_znxdx"] as List<SelectListItem>, new { @style = "width:202px; margin-left:8px; padding:0px;border-radius:0px 0px 0px 0px;border:solid 1px #6C92AD;" })%>
            </p>
            <p style="margin: 10px 0;">
                短信-日历:
                <%=Html.DropDownList("user_rldx", ViewData["list_rldx"] as List<SelectListItem>, new { @style = "width:202px; margin-left:8px; padding:0px;border-radius:0px 0px 0px 0px;border:solid 1px #6C92AD;" })%>
            </p>
            <%--    <p style="margin: 10px 0;">
                审批权限:
                <%=Html.DropDownList("usersspqx", ViewData["list_spqx"] as List<SelectListItem>, new { @style = "width:202px; margin-left:8px; padding:0px;border-radius:0px 0px 0px 0px;border:solid 1px #6C92AD;" })%>
            </p>--%>
            <p style="margin: 10px 0;">
                用户角色:
                <%=Html.DropDownList("user_auth", ViewData["list_auth"] as List<SelectListItem>, new { @style = "width:202px; margin-left:8px; padding:0px;border-radius:0px 0px 0px 0px;border:solid 1px #6C92AD;" })%>
            </p>
        </div>
        <br />
    </fieldset>
</div>
